import request from '@/utils/request';

//获取SPU列表的接口
export const reqSpuList = (page,limit,category3Id)=>request({url:`/admin/product/${page}/${limit}?category3Id=${category3Id}`,method:'get'});


//通过类的ID获取相应数据
export const reqSpuInfoById = (spuId)=>request({url:`/admin/product/getSpuById/${spuId}`,method:'get'});

//获取类的照片墙的接口
export const reqSpuImageList = (spuId)=>request({url:`/admin/product/spuImageList/${spuId}`,method:'get'});


//获取类的品牌的信息
export const reqTradeMarkList = ()=>request({url:`/admin/product/baseTrademark/getTrademarkList`,method:'get'});


//获取全部的销售属性【颜色、尺码、版本】
export const reqSaleAttrList = ()=>request({url:`/admin/product/baseSaleAttrList`,method:'get'});



//新增或者修改SPU的接口函数
//新增与修改SPU参数大致一样的，无非有没有id
export const reqAddOrUpdateSpu = (data)=>{
     if(data.id){
     //修改
     return request({url:`/admin/product/updateSpuInfo`,method:'post',data});
     }else{
      //新增
      return request({url:`/admin/product/saveSpuInfo`,method:'post',data});
     }
}



//获取销售属性列表接口
export const reqSpuSaleAttrList = (spuId)=>request({url:`/admin/product/spuSaleAttrList/${spuId}`,method:'get'});


//添加sku
export const reqAddSku = (data)=>request({url:`/admin/product/saveSkuInfo`,method:'post',data});

//获取sku全部实例的方法
export const reqSkuList = (spuId)=>request({url:`/admin/product/findBySpuId/${spuId}`,method:'get'});


//删除spu的接口
export const reqDeleteSpu = (spuId)=>request({url:`/admin/product/deleteSpu/${spuId}`,method:'delete'});